<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>优家购房系统 - 房屋信息添加</title>
	<!-- 引入css -->
	<link href="../../css/bootstrap.min.css" rel="stylesheet" />
	<!-- 使用bootstrap前端框架，首先引入jquery -->
	<script type="text/javascript" src="../../js/jquery-3.3.1.js"></script>
	<!-- 引入js插件 -->
	<script type="text/javascript" src="../../js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../../My97DatePicker/WdatePicker.js"></script>
	<link rel="stylesheet" href="../../css/main.css">
	<link rel="stylesheet" href="../../lib/font-awesome/css/font-awesome.css">
<script type="text/javascript">
	//获得图片文件的相对路径
	$(function() {
		//alert(6666)
		//ajax实现异步刷新
		$("#imgpath2").change(function(){
			var value = $("#imgpath2").val()
			//alert(666666)
			$.post("../../DataUpdate",{
				img : value
			},function(mes){
				//alert("Data Loaded:"+"../../"+mes);
				$("#imgpath1").attr("src","../../"+mes);
			});
		});
		//将图片的地址赋值给隐藏域，然后由隐藏域把数据传入后台
		$("#imgpath2").change(function() {
			//alert(7777)
			$("#himg").val($("#imgpath2").val())
			//alert($("#himg").val($("#imgpath").val()))
		});
	});
</script>
</head>
<body style="background:url('../../image/bg6.jpg');background-size:cover;">
<div class="box">
	<h3>添加房屋信息</h3>
	<form action="../../HouseServlet?method=add" method="post">
	<table class="form-table">
		<tr>
			<td>地区</td>
			<td colspan="3" class="control">
				<input type="text" name="area" placeholder="填写地区">
			</td>
		</tr>
		<tr>
			<td>小区名字</td>
			<td colspan="3" class="control">
				<input type="text" name="estate" placeholder="小区名字">
			</td>
		</tr>
		<tr>
			<td>单元号</td>
			<td colspan="3" class="control">
				<input type="text" name="unitNumber" placeholder="单元号">
			</td>
		</tr>
		<tr>
			<td>楼层</td>
			<td colspan="3" class="control">
				<input type="text" name="floor" placeholder="楼层(例如：2)">
			</td>
		</tr>
		<tr>
			<td>房间号</td>
			<td colspan="3" class="control">
				<input type="text" name="roomNo" placeholder="房间号">
			</td>
		</tr>
		<tr>
			<td>面积（平米）</td>
			<td colspan="3" class="control">
				<input type="text" name="acreage" placeholder="面积">
			</td>
		</tr>
		<tr>
			<td>朝向</td>
			<td colspan="3" class="control">
				<input type="text" name="direction" placeholder="朝向">
			</td>
		</tr>
		<tr>
			<td>装修</td>
			<td colspan="3" class="control">
				<input type="text" name="fitment" placeholder="装修">
			</td>
		</tr>
		<tr>
			<td>是否双气</td>
			<td colspan="3" class="control">
				<select name="isDoubleAir">
					<option value="0">天然气</option>
					<option value="1">暖气</option>
					<option value="2">双气</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>限住人数</td>
			<td colspan="3" class="control">
				<select name="limit">
					<option value="1">单人间</option>
					<option value="2">双人间</option>
					<option value="3">三人间</option>
					<option value="4">四人间</option>
					<option value="5">五人间</option>
					<option value="6">六人间</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>配套设施</td>
			<td colspan="3" class="control">
				<input type="text" name="facility" placeholder="配套设施">
			</td>
		</tr>
		<tr>
			<td>出租价格（元/月）</td>
			<td colspan="3" class="control">
				<input type="text" name="price" placeholder="出租价格">
			</td>
		</tr>
		<tr>
			<td>出租状态</td>
			<td colspan="3" class="control">
				<select name="status">
					<option value="2">未出租</option>
					<option value="1">已出租</option>
					<option value="0">停止出租</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>房屋图片</td>
			<td colspan="3" class="control">
				<p><img src="" width="300px" height="200px" id="imgpath1"></p>
				<input type="hidden" id="himg" name="img">
					<input type="file" id="imgpath2">
			</td>
		</tr>
		<tr>
			<td>完整地址信息</td>
			<td colspan="3" class="control">
				<input type="text" name="address" placeholder="完整地址信息">
			</td>
		</tr>

		<tr>
			<td>添加时间</td>
			<td colspan="3" class="control">
				<input type="text" name="addTime" placeholder="最初添加房屋的时间" class="Wdate" onClick="WdatePicker()">
			</td>
		</tr>
		<tr>
			<td>更新时间</td>
			<td colspan="3" class="control">
				<input type="text" name="updateTime" placeholder="最后更新房屋的时间" class="Wdate" onClick="WdatePicker()">
			</td>
		</tr>
	</table>
	<div class="buttons">
		<input class="btn btn-primary va-bottom" type="submit" value="保存">&nbsp;&nbsp;
		<a class="btn btn-default" href="javascript:history.go(-1)">返回</a>
	</div>
	</form>
</div>
</body>
</html>